package com.shengjing.apk;

import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

/**
 * 网络类型检测
 * 
 * 
 */
public class NetStatusUtil {
	public static boolean isNetAvaliable = false;

	public static boolean isConnected(Context context) {
		NetworkInfo info = NetStatusUtil.getNetworkInfo(context);
		isNetAvaliable = (info != null && info.isConnected());
		return isNetAvaliable;
	}

	public static NetworkInfo getNetworkInfo(Context context) {
		ConnectivityManager cm = (ConnectivityManager) context
				.getSystemService(Context.CONNECTIVITY_SERVICE);
		return cm.getActiveNetworkInfo();
	}
}
